package com.sy.crm.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.sy.crm.model.Employee;
import com.sy.crm.service.EmployeeManager;

public class EmployeeAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7636519320556620219L;
	private EmployeeManager employeeManager;
	private List employees;
	private Employee employee;
	private Integer id;

	// 添加操作�
	public String add() {
		employeeManager.addEmployee(employee);
		return SUCCESS;
	}

	// 删除操作
	public String delete() {
		employeeManager.deleteEmployee(id);
		return SUCCESS;
	}

	// 修改操作
	public String edit() {
		this.employee = employeeManager.getEmployee(id);
		return SUCCESS;
	}

	// 读取操作
	public String list() {
		this.employees = employeeManager.listEmployee();
		return SUCCESS;
	}

	// 更新操作
	public String update() {
		employeeManager.updateEmployee(employee);
		return SUCCESS;
	}

	// �
	public void setEmployeeManager(EmployeeManager employeeManager) {
		this.employeeManager = employeeManager;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public List getEmployees() {
		return employees;
	}

	public void setEmployees(List employees) {
		this.employees = employees;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
}
